package com.hmsproject.db.inmemorydb;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

import com.hmsproject.datastructures.User;


public class UserMap {

	private static UserMap userMap = new UserMap();
	
	private Map<String,User> userMapper;
	
	private UserMap(){
		userMapper = new HashMap<String,User>();
		User user = new User("Arumugam", "Pillai", "arumugampillaia@gmail.com", "aru123");
		
		user.setVerified(true);
		User user1 = new User("Hotellie1", "User1", "hoteleetestuser1@gmail.com", "evolv123");
		user1.setVerified(true);
		User user2 = new User("Hotellie2", "User2", "hoteleetestuser2@gmail.com", "evolv123");
		user2.setVerified(true);
		userMapper.put("arumugampillaia@gmail.com", user);
		userMapper.put("hoteleetestuser1@gmail.com", user1);
		userMapper.put("hoteleetestuser2@gmail.com", user2);
	}
	
	public static UserMap getInstance(){
		return userMap;
	}
	
	public User getUser(String emailAddString){
		return userMapper.get(emailAddString);
	}
	
	public void addUser(User user){
		userMapper.put(user.getEmailAddress(), user);
	}	
	
	public Collection<User> getAllUsers(){
		return userMapper.values();
	}
	
	
}
